package netty.rpc.core;

import java.io.Serializable;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;

/**
 * 服务描述
 * @author Jim
 * @version 1.0.0
 * @descripition:
 * @date 2022/5/21 14:28
 */
public class ServiceDefinition implements Serializable {

    private static final long serialVersionUID = -7531768574307599144L;

    /**
     * 服务唯一标识 serviceName:version
     * serviceId的目的是进行服务灰度，服务升级后可以在线上进行灰度测试，
     * 导入一部分流量到新版本的服务进行试运行，没有问题再吧流量全部达到新服务上
     */
    private String serviceId;

    /**
     * 服务名
     */
    private String serviceName;

    /**
     * 版本  用于灰度
     */
    private String version;

    /**
     * 环境
     */
    private String envType;

    /**
     * 是否启用
     */
    private boolean enable;


    /**
     * 暴露的接口列表定义
     */
    private Set<InterfaceDefinition> interfaceSet = new HashSet<>();

    public String getServiceId() {
        return serviceId;
    }

    public void setServiceId(String serviceId) {
        this.serviceId = serviceId;
    }

    public String getServiceName() {
        return serviceName;
    }

    public void setServiceName(String serviceName) {
        this.serviceName = serviceName;
    }

    public String getVersion() {
        return version;
    }

    public void setVersion(String version) {
        this.version = version;
    }

    public String getEnvType() {
        return envType;
    }

    public void setEnvType(String envType) {
        this.envType = envType;
    }

    public boolean isEnable() {
        return enable;
    }

    public void setEnable(boolean enable) {
        this.enable = enable;
    }

    public Set<InterfaceDefinition> getInterfaceSet() {
        return interfaceSet;
    }

    public void setInterfaceSet(Set<InterfaceDefinition> interfaceSet) {
        this.interfaceSet = interfaceSet;
    }

    @Override
    public String toString() {
        return "ServiceDefinition{" +
                "serviceId='" + serviceId + '\'' +
                ", serviceName='" + serviceName + '\'' +
                ", version='" + version + '\'' +
                ", envType='" + envType + '\'' +
                ", enable=" + enable +
                ", interfaceSet=" + interfaceSet +
                '}';
    }
}
